//#define SAMPLE_CREATE_THREAD 1

#ifdef SAMPLE_CREATE_THREAD
#pragma region "Sample create thread"
extern "C" {

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

DWORD WINAPI PrintThreads (LPVOID);
static int countThread = 0;

int main () {
	HANDLE hThread;
	DWORD dwThreadID;
	int i;

	for (i=0; i < 5; i++) {
		hThread=CreateThread ( NULL,			//default security attributes
								0,				//default stack size
								PrintThreads,	//function name
								(LPVOID)i,		//parameter
								0,				//start the thread immediately after creation
								&dwThreadID);
		if (hThread) {
			countThread++;
			printf ("Thread launched successfully, thread number: %d, id: %d \n", countThread, dwThreadID);
			CloseHandle (hThread);
		}
	}

	Sleep (1000);
	return (0);
}


//function PrintThreads
DWORD WINAPI PrintThreads (LPVOID num) {
	for (int i=0; i<3; i++) {
		printf ("Thread Number is %d%d%d\n", num,num,num);
	}
	return 0;
} 


}
#pragma endregion
#endif
